package com.unohacha.qqj.fzdr.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lzy.ninegrid.ImageInfo;
import com.lzy.ninegrid.NineGridView;
import com.lzy.ninegrid.preview.NineGridViewClickAdapter;
import com.unohacha.qqj.fzdr.R;
import com.unohacha.qqj.fzdr.bean.SysPushList;
import com.unohacha.qqj.fzdr.bean.SysPuthBean;

import java.util.ArrayList;
import java.util.List;

public class SysPushListAdapter extends BaseQuickAdapter<SysPushList, BaseViewHolder> {
    public SysPushListAdapter(List<SysPushList> data) {
        super(R.layout.item_push_list, data);

    }

    @Override
    protected void convert(final BaseViewHolder helper, final SysPushList pubMatchData) {
        Glide.with(mContext).load(pubMatchData.getMember_pic()).into((ImageView) helper.getView(R.id.store_logo_iv));
        helper.setText(R.id.store_name_tv,pubMatchData.getMember_no());
        helper.setText(R.id.tv_time,pubMatchData.getDate());
        helper.setText(R.id.tv_look,"已有"+pubMatchData.getHits()+"人查看");
        helper.setText(R.id.tv_content,pubMatchData.getTitle());

        //九宫格展示
        ArrayList<ImageInfo> imageInfo = new ArrayList<>();
        List<String> imageDetails = pubMatchData.getList_pic_compress();
        if (imageDetails != null) {
            for (String imageDetail : imageDetails) {
                ImageInfo info = new ImageInfo();
                info.setThumbnailUrl(imageDetail);
                info.setBigImageUrl(imageDetail);
                imageInfo.add(info);
            }
        }
        NineGridView nineGridView = helper.getView(R.id.item_release_rv_picture);
        nineGridView.setSingleImageSize(500);
        nineGridView.setAdapter(new NineGridViewClickAdapter(mContext, imageInfo));

    }

}
